package com.breaktian.assemble.customviews.dialog;

import android.app.Dialog;
import android.content.Context;
import android.graphics.drawable.AnimationDrawable;
import android.support.annotation.NonNull;
import android.support.annotation.Nullable;
import android.support.annotation.StyleRes;
import android.widget.ImageView;

import com.breaktian.assemble.R;

/**
 * Created by keke.tian on 2017/8/21.
 */

public class LoadingDialog extends Dialog {
    private ImageView mLoadingImageView;

    public LoadingDialog(@NonNull Context context) {
        super(context);
        init(context);
    }

    public LoadingDialog(@NonNull Context context, @StyleRes int themeResId) {
        super(context, themeResId);
        init(context);
    }

    protected LoadingDialog(@NonNull Context context, boolean cancelable, @Nullable OnCancelListener cancelListener) {
        super(context, cancelable, cancelListener);
        init(context);
    }

    private void init(Context context) {
        setContentView(R.layout.bm_loading_dialog);
        mLoadingImageView = (ImageView)findViewById(R.id.loading_image_view);

    }

    @Override
    public void show() {
        ((AnimationDrawable) mLoadingImageView.getBackground()).start();
        super.show();
    }

    @Override
    public void dismiss() {
        ((AnimationDrawable) mLoadingImageView.getBackground()).stop();
        super.dismiss();
    }

    public static class Instance{



    }



}
